package com.newtouch.bxzs.database.synchronize.batch.reader;

import com.newtouch.bxzs.database.synchronize.model.CustomerBO;
import com.newtouch.bxzs.database.synchronize.model.OrganizationBO;
import com.newtouch.bxzs.database.synchronize.model.SynProductVO;
import com.newtouch.bxzs.database.synchronize.model.UserBO;
import com.newtouch.bxzs.database.synchronize.model.achievement.AchievementPolicyVO;
import com.newtouch.bxzs.database.synchronize.model.achievement.AchievementVO;
import com.newtouch.bxzs.database.synchronize.model.income.IncomeDetailVO;
import com.newtouch.bxzs.database.synchronize.model.income.IncomeEstimateVO;
import com.newtouch.bxzs.database.synchronize.model.income.IncomeVO;
import com.newtouch.bxzs.database.synchronize.service.SynchronizeOppositeClient;
import com.newtouch.bxzs.database.synchronize.service.SynchronizeOwnClient;
import org.springframework.batch.item.ItemReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
 * 读取同步数据
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/1/7 10:58</td>
 * <td>Amour</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author yuanjie
 * @version 1.0.0
 * @since 1.0.0
 */
@Component
public class ReaderData {

    @Autowired
    private SynchronizeOppositeClient synchronizeOppositeClient;

    @Autowired
    private SynchronizeOwnClient synchronizeOwnClient;


    /**
     * 获取客户数据
     * @return ItemReader
     */
    public ItemReader<CustomerBO> synchronizedCustomerList() {
        return new ItemReaderFactory<>(synchronizeOwnClient.synchronizedCustomer());
    }

    /**
     * 获取本端机构数据
     * @return ItemReader
     */
    public ItemReader<OrganizationBO> synchronizeOwnOrganrList(){
        return new ItemReaderFactory<>(synchronizeOwnClient.synchronizeOwnOrgan());
    }

    /**
     * 获取对端机构数据
     * @return ItemReader
     */
    public ItemReader<OrganizationBO> getOppositeOrganizationOther(){
        return new ItemReaderFactory<>(synchronizeOppositeClient.getOppositeOrganization());
    }


    /**
     * 获取本端用户数据
     * @return ItemReader
     */
    public ItemReader<UserBO> getOwnUser(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getOwnUser());
    }

    /**
     * 获取对端用户数据
     * @return ItemReader
     */
    public ItemReader<UserBO> getOppositeUserOther(){
        return new ItemReaderFactory<>(synchronizeOppositeClient.getOppositeUserOther());
    }

    /**
     * 获取个人业绩数据
     * @return ItemReader
     */
    public ItemReader<AchievementVO> getAchievement(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getAchievement());

    }

    /**
     * 获取个人业绩明细数据
     * @return ItemReader
     */
    public ItemReader<AchievementPolicyVO> getAchievementPolicy(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getAchievementPolicy());
    }

    /**
     * 获取个人收入
     * @return ItemReader
     */
    public ItemReader<IncomeVO> getIncome(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getIncome());
    }

    /**
     * 获取个人收入详细
     * @return ItemReader
     */
    public ItemReader<IncomeDetailVO> getIncomeDetail(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getIncomeDetail());
    }

    /**
     * 获取个人预估收入
     * @return ItemReader
     */
    public ItemReader<IncomeEstimateVO> getIncomeEstimate(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getIncomeEstimate());
    }

    /**
     * 获取个人收入详细
     * @return ItemReader
     */
    public ItemReader<IncomeDetailVO> getIncomeEstimateDetail(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getIncomeEstimateDetail());
    }

    /**
     * 获取产品信息
     * @return ItemReader
     */
    public ItemReader<SynProductVO> getProductList(){
        return new ItemReaderFactory<>(synchronizeOwnClient.getProductList());
    }

}
